package com.lovo.total.frame;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.ArrayList;

import javax.swing.BorderFactory;
import javax.swing.JFrame;
import javax.swing.JPanel;

import com.lovo.emp.frame.EmpAddDialog;
import com.lovo.emp.frame.EmpPanel;
import com.lovo.emp.frame.EmpShowDialog;
import com.lovo.emp.frame.EmpUpdateDialog;
import com.lovo.netCRM.component.LovoButton;
import com.lovo.netCRM.component.LovoComboBox;
import com.lovo.netCRM.component.LovoCutPage;
import com.lovo.netCRM.component.LovoDate;
import com.lovo.netCRM.component.LovoList;
import com.lovo.netCRM.component.LovoTable;
import com.lovo.netCRM.component.LovoTitleLabel;
import com.lovo.netCRM.component.LovoTitlePanel;
import com.lovo.netCRM.component.LovoTxt;

/**
 * 学校统计主面板
 * @author 白德柯
 *
 */
public class SchoolTotalPanel extends JPanel{


	/**学校统计表格组件*/
	private LovoTable schoolTotalTable;
	/**窗体组件*/
	private JFrame jf;
	/**起始日期*/
	private LovoDate startDate;
	/**结束日期*/
	private LovoDate endDate;
	/**城市列表*/
	private LovoList cityList;
	/**分页对象*/
	private LovoCutPage cutPage;

	public SchoolTotalPanel(JFrame jf){
		this.jf = jf;
		this.setLayout(null);
		this.init();
	}
	/**
	 * 初始化
	 *
	 */
	private void init() {
		new LovoTitleLabel("学 校 统 计",this);
		this.initTable();
		this.initList();
		this.initFindPanel();
		this.initData();
	}
	/**
	 * 初始化数据
	 */
	public void initData(){
		this.updateTable(1);
	}
	
	

	
	//-------------------------------------------------
	/**
	 * 初始化表格
	 *
	 */
	private void initTable() {
		schoolTotalTable = new LovoTable(this,
				new String[]{"学校名称","网脉班级数量","会员数量","非会员数量"},
				new String[]{},//学校统计实体属性名数组 
				"");//主键属性名 
		schoolTotalTable.setSizeAndLocation(220, 90, 500, 300);
		// 分页
		cutPage = new LovoCutPage(220,400,this) {
			@Override
			public void clickEvent(int arg0) {
				
			}
		};
	}
	
	
	/**
	 * 初始化查询按钮
	 *
	 */
	private void initFindPanel(){

		LovoTitlePanel jp = new LovoTitlePanel("按录入时间查询",400, 460, 320, 130,this);
		this.startDate = new LovoDate("起始日期",30,30,jp);
		this.endDate = new LovoDate("结束日期",30,60,jp);
		
		LovoButton findButton = new LovoButton("查找",180,90,jp);
		findButton.setSize(60, 20);

		
	}
	/**
	 * 初始化列表
	 */
	private void initList() {
		cityList = new LovoList(20, 90, 195, 300, new ArrayList(), this);
		cityList.setBorder(BorderFactory.createEtchedBorder());
	}
	/**
	 * 更新表格数据
	 */
	private void updateTable(int page){
		//更新表格
		schoolTotalTable.updateLovoTable(null);
	}
	




}
